<?php

namespace app\admin\controller;

class Introduce extends Base
{
    //留学生在日高考优势
    public function introduce_list()
    {
        if (request()->isAjax()){
            $data = input('post.');
            $result = model('common/Introduce') -> introduce_list($data);
            if($result == 1){
                $this -> success('更新成功！','admin/introduce/introduce_list');
            } else {
                $this -> error($result);
            }
        }
        $in = model('common/Introduce')
            -> where('id',1)
            -> field('id,content,title')
            -> find();
        $data = [
            'in' => $in
        ];
        $this -> assign($data);
        return view();
    }

    //留学费用
    public function introduce_cost()
    {
        if (request()->isAjax()){
            $data = input('post.');
            $result = model('common/Introduce') -> introduce_cost($data);
            if($result == 1){
                $this -> success('更新成功！','admin/introduce/introduce_cost');
            } else {
                $this -> error($result);
            }
        }
        $in = model('common/Introduce')
            -> where('id',2)
            -> field('id,title,content')
            -> find();
        $data = [
            'in' => $in
        ];
        $this -> assign($data);
        return view();
    }

    //日本就业
    public function introduce_job()
    {
        if (request()->isAjax()){
            $data = input('post.');
            $result = model('common/Introduce') -> introduce_job($data);
            if($result == 1){
                $this -> success('更新成功！','admin/introduce/introduce_job');
            } else {
                $this -> error($result);
            }
        }
        $in = model('common/Introduce')
            -> where('id',3)
            -> field('id,title,author,content')
            -> find();
        $data = [
            'in' => $in
        ];
        $this -> assign($data);
        return view();
    }

    //全局展望
    public function introduce_look()
    {
        if (request()->isAjax()){
            $data = input('post.');
            $result = model('common/Introduce') -> introduce_look($data);
            if($result == 1){
                $this -> success('更新成功！','admin/introduce/introduce_look');
            } else {
                $this -> error($result);
            }
        }
        $in = model('common/Introduce')
            -> where('id',4)
            -> field('id,title,author,content')
            -> find();
        $data = [
            'in' => $in
        ];
        $this -> assign($data);
        return view();
    }

}
